<template>
<slot :controller="controller" :store="store" :model="model">
    <div :class="classNames">
        <slot name="container1Container" :controller="controller" :store="store" :model="model" >
        <AppStandardContainer 
            name="container1"
            v-show="store.layoutModelDetails?.container1?.visible"
            :isMultiContainer="false"
            :layoutModelDetails="store.layoutModelDetails">
            <template #app_apptitle>
                <slot name="app_apptitle" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetTitle
                    name="app_apptitle"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails"/>
                </slot>  
            </template>
            <template #view_pagecaption>
                <slot name="view_pagecaption" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetCaption 
                    v-if="model.showCaption && !noViewCaption"
                    name="view_pagecaption"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails">
                    {{model.caption}}
                </AppPresetCaption>
                </slot>
            </template>
            <template #container_group1>
                <slot name="container_group1Container" :controller="controller" :store="store" :model="model" >
                <AppStandardContainer 
                    name="container_group1"
                    v-show="store.layoutModelDetails?.container_group1?.visible"
                    :isMultiContainer="false"
                    :layoutModelDetails="store.layoutModelDetails">
                    <template #static_label2>
                        <slot name="static_label2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                        <AppPresetText 
                            name="static_label2"
                            @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                            :layoutModelDetails="store.layoutModelDetails" />
                        </slot>
                    </template>
                </AppStandardContainer>
                </slot>
            </template>
            <template #static_label1>
                <slot name="static_label1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_label1"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #static_text1>
                <slot name="static_text1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText 
                    name="static_text1"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails" />
                </slot>
            </template>
            <template #field_text_dynamic>
                <slot name="field_text_dynamic" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetText
                    name="field_text_dynamic"
                    :value="store.layoutData.field_text_dynamic"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    :layoutModelDetails="store.layoutModelDetails"/>
                </slot>
            </template>
            <template #field_textbox4>
                <slot name="field_textbox4" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_textbox4"
                    :value="store.layoutData.field_textbox4"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_textbox4Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppInput
                        v-bind="{ editorType: 'TEXTBOX', }"
                        type="text"
                        style=""
                        name="field_textbox4"
                        :isDebounce="true"
                        :disabled="store.layoutModelDetails.field_textbox4?.disabled ? true : false"
                        :value="store.layoutData.field_textbox4"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_switch>
                <slot name="field_switch" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_switch"
                    :value="store.layoutData.field_switch"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_switchEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppSwitch
                        v-bind="{ editorType: 'SWITCH', }"
                        style=""
                        name="field_switch"
                        :disabled="store.layoutModelDetails?.field_switch?.disabled ? true : false"
                        :value="store.layoutData.field_switch"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_textbox>
                <slot name="field_textbox" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_textbox"
                    :value="store.layoutData.field_textbox"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_textboxEditor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppInput
                        v-bind="{ editorType: 'TEXTBOX', }"
                        type="text"
                        style=""
                        name="field_textbox"
                        :isDebounce="true"
                        :disabled="store.layoutModelDetails.field_textbox?.disabled ? true : false"
                        :value="store.layoutData.field_textbox"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_textbox1>
                <slot name="field_textbox1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_textbox1"
                    :value="store.layoutData.field_textbox1"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_textbox1Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppDropdownList
                        v-bind="{ editorType: 'DROPDOWNLIST', }"
                        :multiple="false"
                        :context="store.context"
                        :viewParams="store.viewParams"
                        style=""
                        name="field_textbox1"
                        :data="store.layoutData"
                        :disabled="store.layoutModelDetails?.field_textbox1?.disabled ? true : false"
                        :value="store.layoutData.field_textbox1"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    /> 
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_textbox2>
                <slot name="field_textbox2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_textbox2"
                    :value="store.layoutData.field_textbox2"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_textbox2Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppInput
                        v-bind="{ editorType: 'NUMBER', }"
                        type="number"
                        style=""
                        name="field_textbox2"
                        :isDebounce="true"
                        :disabled="store.layoutModelDetails.field_textbox2?.disabled ? true : false"
                        :value="store.layoutData.field_textbox2"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_textbox3>
                <slot name="field_textbox3" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPanelField
                    name="field_textbox3"
                    :value="store.layoutData.field_textbox3"
                    :layoutModelDetails="store.layoutModelDetails">
                    <slot name="field_textbox3Editor" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                    <AppInput
                        v-bind="{ editorType: 'PASSWORD', }"
                        type="password"
                        style=""
                        name="field_textbox3"
                        :isDebounce="true"
                        :disabled="store.layoutModelDetails.field_textbox3?.disabled ? true : false"
                        :value="store.layoutData.field_textbox3"
                        @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                    </slot>
                </AppPanelField>
                </slot>
            </template>
            <template #field_qrcode>
                <slot name="field_qrcode" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetQrcode
                    name="field_qrcode"
                    :value="store.layoutData.field_qrcode"
                    :layoutModelDetails="store.layoutModelDetails"/>  
                </slot>
            </template>
            <template #button_link1>
                <slot name="button_link1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_link1"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_link1"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_openview>
                <slot name="button_openview" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_openview"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_openview"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic1>
                <slot name="button_calluilogic1" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic1"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic1"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic2>
                <slot name="button_calluilogic2" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic2"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic2"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic3>
                <slot name="button_calluilogic3" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic3"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic3"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic5>
                <slot name="button_calluilogic5" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic5"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic5"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic6>
                <slot name="button_calluilogic6" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic6"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic6"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic8>
                <slot name="button_calluilogic8" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic8"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic8"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic9>
                <slot name="button_calluilogic9" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic9"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic9"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #button_calluilogic10>
                <slot name="button_calluilogic10" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="button_calluilogic10"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.button_calluilogic10"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
            <template #open_yuque>
                <slot name="open_yuque" :controller="controller" :store="store" :model="model"  :actions="{ handleComponentAction }">
                <AppPresetButton
                    name="open_yuque"
                    :loading="store.loadingHelper.isLoading"
                    :layoutModelDetails="store.layoutModelDetails"
                    :value="store.layoutData.open_yuque"
                    @component-action="(actionParam: IEvent<string>) => { handleComponentAction(controller, actionParam) }"
                    />
                </slot>
            </template>
        </AppStandardContainer>
        </slot>
    </div>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/views/{{appModules}}/{{pages@APPINDEXVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppCtrlPos, AppScrollContainer, AppSimpleFlexContainer, AppStandardContainer, AppTabPanel, AppTabPage } from '@components/layout-element/structure';

import AppIndexViewMenu from '@widgets/app/app-index-view-menu/app-index-view-menu.vue';
import { IEvent, IIndexViewAbility, IIndexViewStore, IndexViewActionType, IParam } from "@/core";
import { useController, useProps, useBasic, useAction} from './app-index-view-hook';
import { MicroActions } from '@/micro/global-state';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy 
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: IndexViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IIndexViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IIndexViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})

onMounted(() => {
	setTimeout(() => {
		App.noticeBaseApp(MicroActions.APPINIT,true);
	}, 0);
});
</script>